<%@taglib uri="/WEB-INF/webflow.tld" prefix="webflow" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>

<%@page import="com.broadvision.ssp.webflow.WebflowHelper" %>
<%@page import="com.broadvision.ssp.common.SSContext" %>
<%@page import="com.broadvision.ssp.common.TaskPriority" %>
<%@page import="com.broadvision.ssp.client.workflow.*" %>
<%@page import="com.broadvision.ssp.client.*" %>
<%@page import="com.broadvision.ssp.util.*" %>
<%@page import="com.broadvision.portal.services.microsite.BizProcessMicrosite" %>
<%@page import="com.broadvision.portal.services.PortalVisitor" %>
<%@page import="com.broadvision.visitor.client.VisitorManager" %>
<%@page import="com.broadvision.portal.services.InsufficientPermissionException" %>

<webflow:advance id="url"/>
<%
 SSContext ctx = WebflowHelper.getWebflowContext(request);
 Long micrositeId = (Long) ctx.getAttribute("micrositeId");

 String micrositeIdStr = null;

 if (micrositeId == null)
  System.out.println("Microsite Id is null.");

 micrositeIdStr = micrositeId.toString();
 pageContext.setAttribute("micrositeIdStr",micrositeIdStr);
 TaskItem taskItem = (TaskItem) ctx.getAttribute(SSContext.TASK_ITEM_CTX_OBJ);
 String priority=TaskPriority.getTaskPriorityString(taskItem.getPriority().toString());
 pageContext.setAttribute("taskItemBean", taskItem);

 Integer serviceId = (Integer) ctx.getAttribute(SSContext.SERVICE_ID_CTX_NAME);
 String workflowInstanceId = (String) ctx.getAttribute(SSContext.WORKFLOW_INSTANCE_ID_CTX_NAME);
 SspInstance sspInstance = SspInstance.getSspInstance(Long.parseLong(workflowInstanceId));

 String sspName = sspInstance.getSspName();
 Long userId = (Long) ctx.getAttribute(SSContext.USER_ID_CTX_NAME);
 PortalVisitor portalVisitor = new PortalVisitor (userId.longValue());
 BizProcessMicrosite microsite = null;
 
 try {
   microsite = new BizProcessMicrosite(serviceId.intValue(), micrositeId.longValue(), portalVisitor);

 } catch (InsufficientPermissionException e) {
    // use pmcadmin to  retrieve view only ms, get owner group from the ms and get the first owner
   VisitorManager visitorMgr = new VisitorManager();
   PortalVisitor bvAdmin = new PortalVisitor(visitorMgr.getVisitor(TableConstants.BVADMIN));
   microsite = new BizProcessMicrosite(serviceId.intValue(), micrositeId.longValue(), bvAdmin); 

 }

%>

	  <!-- Zone 5 starts here.  -->
		  
		  <table class="zoneFive" width="100%" border="0" cellspacing="0" cellpadding="0" summary="content area">
		    <tr>
			<td valign="top" width="100%">
		    
			<div class="app_pageTitle"><bean:write name="taskItemBean" property="name" /></div> 
			
			<div class="app_pageSubtitle">
			    <span class="left"><bean:message key="cs.collaboration.setup.TaskInformation" /></span>
				<span class="right">
				  &nbsp;
			    </span>
			</div> 
			<!--end page title area here-->
			
			
			 <table class="labelForm" width="100%" border="0" cellspacing="0" cellpadding="0" summary="Account information">
			   <tr> 
			     <td class="label" width="20%"><bean:message key="cs.collaboration.setup.duedate" />:</td>
			     <td class="labelField" width="80%">
            <bean:write name="taskItemBean" property="duedate" formatKey="format.datetime.medium" /> 
           </td>
			   </tr>
			   <tr> 
			     <td class="label" width="20%"><bean:message key="cs.collaboration.setup.priority" />:</td>
			     <td class="labelField" width="80%">
                              <%=priority%>
				   </td>
			   </tr>
			   <tr> 
			     <td class="label" width="20%"><bean:message key="cs.collaboration.setup.processName" />:</td>
			     <td class="labelField" width="80%">
           <%=sspName%>
				 </td>
			   </tr>
			   <tr> 
			     <td class="label" width="20%"><bean:message key="cs.collaboration.setup.instructions" />:</td>
			     <td class="labelField" width="80%">
			     <p><bean:message key="cs.collaboration.complete.note1" arg0="<%=microsite.getName()%>" />&nbsp;
			     <bean:write name="taskItemBean" property="duedate" formatKey="format.datetime.medium" />.
			     <p><bean:message key="cs.collaboration.complete.note2" />&nbsp;
                 <html:link page="/cs/collaborationCloseSummary.do?currentAction=summary" paramId="micrositeId" paramName="micrositeIdStr" styleClass="blueTextLink"><%=microsite.getName()%></html:link>
                 &nbsp;<bean:message key="cs.collaboration.complete.note3" /> 
				 </td>
			   </tr>
			 </table>
			 
             
	        </td>
		  </tr>
		</table>
		<!--end zone 5 content here -->
